#include <stdlib.h>
#include <stdio.h> 
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <string.h>
#define PORT 34875
void main(void)
{
	char *buf = "marry has a little lamb";
	char ret_buf[64];
	struct sockaddr_in sock;
	int fd = socket(AF_INET, SOCK_STREAM, 0);
	memset(&sock, 0, sizeof(struct sockaddr_in));
	sock.sin_family = AF_INET;
	inet_pton(AF_INET, "127.0.0.1", &sock.sin_addr);
	//sock.sin_addr.s_addr = htonl(inet_addr("127.0.0.1"));
	sock.sin_port = htons(PORT);
	connect(fd, (struct sockaddr *)&sock, sizeof(sock));
//	while (1) {
		write(fd, buf, strlen(buf));
		read(fd, ret_buf, sizeof(ret_buf));
		printf("%s\n", ret_buf);
		close(fd);
//	}
}
